package com.cnpc.framework.base.service;

import com.cnpc.framework.base.entity.BaseResponse;
import com.cnpc.framework.base.entity.User;
import com.cnpc.framework.base.entity.UserAvatar;
import com.cnpc.framework.base.pojo.Result;
import com.lc.entity.UserTag;
import com.lc.entity.UserTagChange;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

public interface UserService extends BaseService {

    /**
     * 根据登录名获取用户
     *
     * @param loginName 登录名
     * @return
     */
    User getUserByLoginName(String loginName);

    /**
     * 根据用户Id 获取头像
     *
     * @param userId
     * @return
     */
    UserAvatar getAvatarByUserId(String userId);

    /**
     * 关联头像和用户 user.getAvatarId()
     *
     * @param user
     * @param dirPath 项目目录
     */
    void updateUserAvatar(User user, String dirPath);

    User getUserById(String userId);
    Result deleteUser(String userId,String edituser);
    Result deleteUsers(List<String> userIds,String edituser);

    /**
     * 清除redis中的相关权限设置，主要在更新权限时使用
     * @param userId
     */
    void deleteAuthInRedis(String userId);

    String getUserNamesByUserIds(String userIds);

    public BaseResponse updatePassword(String loginName, String password) throws Exception;

    public Result editUser(User user) throws Exception;
    public Result editUserWithoutTags(User user) throws Exception;
    public Result editUserTags(UserTagChange userTagChange) throws Exception;
    public Result editUserDept(List<String> userIds,String deptId,String edituser) throws Exception;
    Result updateUserState(String id, int state, String reason)throws Exception;

    public List<Map<String,Object>> getUserList(String name,String empNo,String sex,String arole,String deptId,String wrDeptId, String sh,String startTime,String endTime, Integer pageNum, Integer pageSize)throws Exception;
    public long getUserCount(String name,String empNo,String sex,String arole,String deptId,String wrDeptId,String sh,String startTime,String endTime)throws Exception;

    public List<Map<String,Object>> getUserListByAuth(String userId,String name,String empNo,String sex,String arole,String deptId, String sh,String startTime,String endTime, Integer pageNum, Integer pageSize)throws Exception;
    public long getUserCountByAuth(String userId,String name,String empNo,String sex,String arole,String deptId,String sh,String startTime,String endTime)throws Exception;

    public List<String> getOrgIdsAndBellow(String userId) throws Exception;
    public List<String> getOrgIdsAndBellow(String userId,String orgId) throws Exception;
    public Map<String,Object> getHigherOrgIds(String userId) throws Exception;

    public BaseResponse importUserList(MultipartFile excel) throws Exception;

}
